package com.gxlu.ms.base.exception;

import java.util.HashMap;
import java.util.Map;

/**
 * 自定义异常类
 *
 * @author andy.lhc
 * @date 2018/03/15
 */
public class BaseException extends RuntimeException {

    private String errorCode ;

    private String errorMsg ;


    private Map<String,Object> feature = new HashMap<>(16);

    public  BaseException(){
        super();
    }

    public BaseException(String errorCode,String errorMsg) {
        super(errorCode);
        setErrInfo(errorCode,errorMsg);
    }

    public BaseException(String message) {
        super(message);
    }

    public BaseException(String message,String errorCode,String errorMsg) {
        super(message);
        setErrInfo(errorCode,errorMsg);
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
    }

    public BaseException(String message, Throwable cause,String errorCode,String errorMsg) {
        super(message, cause);
        setErrInfo(errorCode,errorMsg);
    }

    public BaseException(Throwable cause) {
        super(cause);
    }

    public BaseException(Throwable cause,String errorCode,String errorMsg) {
        super(cause);
        setErrInfo(errorCode,errorMsg);
    }

    protected void setErrInfo(String errorCode,String errorMsg){
        this.errorCode = errorCode ;
        this.errorMsg = errorMsg ;
    }

    public Map<String, Object> getFeature() {
        return feature;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }
}
